# -*- coding:utf-8 -*-
#! python3

from facecat import *

gPaint = FCPaint() #创建绘图对象
gPaint.defaultUIStyle = "dark"

#消息循环
def WndProc(hwnd,msg,wParam,lParam):
	return WndProcDefault(gPaint,hwnd,msg,wParam,lParam)

#创建窗体
createMainWindow(gPaint, "facecat-py", WndProc)

#创建多页夹
tabView = FCTabView()
#添加到框架
addView(tabView, gPaint)
#根据主题设置配色
if tabView.paint.defaultUIStyle == "dark":
	tabView.backColor = "rgb(0,0,0)"
	tabView.borderColor = "rgb(100,100,100)"
	tabView.textColor = "rgb(255,255,255)"
elif tabView.paint.defaultUIStyle == "light":
	tabView.backColor = "rgb(255,255,255)"
	tabView.borderColor = "rgb(150,150,150)"
	tabView.textColor = "rgb(0,0,0)"
#填充布局
tabView.dock = "fill"
tabView.borderColor =  "none"
tabView.underLineColor = "rgb(255,215,0)"
#设置布局方式
tabView.layout = "bottom"

#添加多页夹
for i in range(0,4):
	#创建页夹
	tabPage = FCTabPage()
	tabPage.paint = gPaint
	if i == 0:
		tabPage.visible = True
	else:
		tabPage.visible = False
	tabPage.borderColor = "none"
	tabPage.parent = tabView
	#创建页夹对应的按钮
	tabButton = FCView()
	tabButton.paint = gPaint;
	tabButton.viewType = "tabbutton"
	#设置文字
	tabButton.text = "第" + str(i + 1) + "页"
	#设置大小
	tabButton.size = FCSize(100, 20)
	#设置不同的颜色
	tabButton.textColor = "rgb(0,0,0)"
	if i == 0:
		tabPage.backColor = "rgb(255,0,0)"
	elif i == 1:
		tabPage.backColor = "rgb(0,255,0)"
	elif i == 2:
		tabPage.backColor = "rgb(0,0,255)"
	elif i == 3:
		tabPage.backColor = "rgb(255,0,255)"
	#添加页夹和按钮到多页夹视图中
	addTabPage(tabView, tabPage, tabButton)
	#根据主题配色
	if tabView.paint.defaultUIStyle == "dark":
		tabButton.backColor = "rgb(0,0,0)"
		tabButton.borderColor = "rgb(100,100,100)"
		tabButton.textColor = "rgb(255,255,255)"
	elif tabView.paint.defaultUIStyle == "light":
		tabButton.backColor = "rgb(255,255,255)"
		tabButton.borderColor = "rgb(150,150,150)"
		tabButton.textColor = "rgb(0,0,0)"

#更新多页加布局
updateTabLayout(tabView)
updateViewDefault(gPaint.views)
showWindow(gPaint)